<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE html>
<html lang="en">
<head>
    <base href="<%=basePath%>">
    <meta charset="utf-8"/>
    <title>广告位</title>
    <meta name="description" content="overview & stats"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <link href="static/css/bootstrap.min.css" rel="stylesheet"/>
    <link href="static/css/bootstrap-responsive.min.css" rel="stylesheet"/>
    <link rel="stylesheet" href="static/css/font-awesome.min.css"/>
    <link rel="stylesheet" href="static/css/ace.min.css"/>
    <link rel="stylesheet" href="static/css/ace-responsive.min.css"/>
    <link rel="stylesheet" href="static/css/ace-skins.min.css"/>
    <script type="text/javascript" src="static/js/jquery-1.7.2.js"></script>
    <!--提示框-->
    <script type="text/javascript" src="static/js/jquery.tips.js"></script>
</head>

<script type="text/javascript">
    $(function () {
        top.hangge();
    });

    //保存
    function save() {
        var name = $("#name").val();
        if (name == "") {
            $("#name").tips({
                side: 3,
                msg: '请输入名称',
                bg: '#AE81FF',
                time: 2
            });
            $("#name").focus();
            return false;
        }
        var code = $("#code").val();
        $.get("pxAdversterSlot/checkName",
            {"id": $("#id").val(),"name": name,"code":code},
            function (data) {
                if (data.code == 200) {
                    $("#menuForm").submit();
                    $("#zhongxin").hide();
                    $("#zhongxin2").show();
                } else {
                    $("#name").tips({
                        side: 3,
                        msg: data.msg,
                        bg: '#AE81FF',
                        time: 2
                    });
                    $("#name").focus();
                    return false;
                }
            });
    }
</script>
<body>
<form action="pxAdversterSlot/edit" name="menuForm" id="menuForm" method="post" enctype="multipart/form-data">
    <input type="hidden" id="id" name="id" value="${adversterSlot.id}">
    <div id="zhongxin" class="zhongxin-cla">
        <table>
            <tr>
                <td>
                    <font color='red'>*</font>
                    <span>广告商名称：</span>
                    <input type="text" name="name" id="name" style="width:200px;" value="${adversterSlot.name}" placeholder="广告商名称"/>
                </td>
            </tr>
            <tr>
                <td>
                   <%-- <font color='red'>*</font>--%>
                    <span>广告位编码：</span>
                    <input type="text" name="code" id="code" style="width:200px;" value="${adversterSlot.code}" placeholder="广告位编码"/>
                </td>
            </tr>
            <tr>
                <td>
                   <%-- <font color='red'>*</font>--%>
                    <span>广告位类型：</span>
                    <select id="slotType" name="type" data-placeholder="请选择广告位类型" style="vertical-align:top;width:200px;">
                        <option value="">选择广告位类型</option>
                        <option value="0" <c:if test="${adversterSlot.type != null && adversterSlot.type == 0}">selected</c:if>>banner</option>
                        <option value="1" <c:if test="${adversterSlot.type != null && adversterSlot.type == 1}">selected</c:if>>弹窗</option>
                        <option value="2" <c:if test="${adversterSlot.type != null && adversterSlot.type == 2}">selected</c:if>>插屏</option>
                        <option value="3" <c:if test="${adversterSlot.type != null && adversterSlot.type == 3}">selected</c:if>>悬浮</option>
                        <option value="4" <c:if test="${adversterSlot.type != null && adversterSlot.type == 4}">selected</c:if>>原生</option>
                        <option value="5" <c:if test="${adversterSlot.type != null && adversterSlot.type == 5}">selected</c:if>>视频</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td>
                    <%--<font color='red'>*</font>--%>
                    <span>广告位状态：</span>
                    <select id="slotStatus" name="status" data-placeholder="请选择停启用状态" style="vertical-align:top;width:200px;">
                        <option value="">选择停启用状态</option>
                        <option value="0" <c:if test="${adversterSlot.status != null && adversterSlot.status == 0}">selected</c:if>>停用</option>
                        <option value="1" <c:if test="${adversterSlot.status != null && adversterSlot.status == 1}">selected</c:if>>启用</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td>
                    <%-- <font color='red'>*</font>--%>
                    <span>广告位尺寸：</span>
                    <input type="text" name="widthHeight" id="widthHeight" style="width:200px" value="${adversterSlot.widthHeight}" placeholder="广告位尺寸"/>
                </td>
            </tr>
            <tr>
                <td>
                    <%--<font color='red'>*</font>--%>
                    <span>支持的平台：</span>
                    <select id="platform" name="platform" data-placeholder="请选择支持的平台" style="vertical-align:top;width:200px">
                        <option value="">选择平台</option>
                        <option value="0" <c:if test="${adversterSlot.platform != null && adversterSlot.platform == 0}">selected</c:if>>iOS</option>
                        <option value="1" <c:if test="${adversterSlot.platform != null && adversterSlot.platform == 1}">selected</c:if>>Android</option>
                        <option value="2" <c:if test="${adversterSlot.platform != null && adversterSlot.platform == 2}">selected</c:if>>iOS+Android</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td>
                    <%-- <font color='red'>*</font>--%>
                    <span>最多可支持的广告数量：</span>
                    <input type="number" name="maxAds" id="maxAds" value="${adversterSlot.maxAds}" style="width:200px" placeholder="最大广告数量" />
                </td>
            </tr>
            <tr>
                <td>
                   <%-- <font color='red'>*</font>--%>
                    <span>是否轮播：</span>
                    <select id="isAutoRotate" name="isAutoRotate" data-placeholder="请选择是否轮播" style="vertical-align:top;width:200px;">
                        <option value="">选择是否轮播</option>
                        <option value="0" <c:if test="${adversterSlot.isAutoRotate != null && adversterSlot.isAutoRotate == 0}">selected</c:if>>否</option>
                        <option value="1" <c:if test="${adversterSlot.isAutoRotate != null && adversterSlot.isAutoRotate == 1}">selected</c:if>>是</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td>
                    <%--<font color='red'>*</font>--%>
                    <span>轮播间隔时间（秒）：</span>
                    <input type="number" name="rotationInterval" id="rotationInterval" value="${adversterSlot.rotationInterval}" style="width:200px;" placeholder="轮播间隔时间"/>
                </td>
            </tr>
            <tr>
                <td>
                    <font color='red'>*</font>
                    <span>首次播放时间间隔（秒）：</span>
                    <input type="number" name="firstShowInterval" id="firstShowInterval" value="${adversterSlot.firstShowInterval}" style="width:200px;" placeholder="首次播放时间间隔"/>
                </td>
            </tr>
            <tr>
                <td>
                  <%--  <font color='red'>*</font>--%>
                    <span>播放时间间隔（秒）：</span>
                    <input type="number" name="showInterval" id="showInterval" value="${adversterSlot.showInterval}" style="width:200px;" placeholder="播放时间间隔"/>
                </td>
            </tr>
            <tr>
                <td>
                    <%-- <font color='red'>*</font>--%>
                    <span>每天播放的最大次数：</span>
                    <input type="number" name="maxFrequency" id="maxFrequency" value="${adversterSlot.maxFrequency}" style="width:200px;" placeholder="每天播放的最大次数"/>
                </td>
            </tr>
            <tr>
                <td>
                    <%-- <font color='red'>*</font>--%>
                    <span>广告位说明：</span>
                    <input type="text" name="desc" id="desc" style="width:200px;" value="${adversterSlot.desc}" placeholder="广告位说明"/>
                </td>
            </tr>
            <tr>
                <td style="text-align: center; padding-top: 10px;">
                    <a class="btn btn-mini btn-primary" onclick="save();">保存</a>
                    <a class="btn btn-mini btn-danger" onclick="top.Dialog.close();">取消</a>
                </td>
            </tr>
        </table>
    </div>
    <div id="zhongxin2" class="center" style="display:none">
        <br/><br/><br/><img src="static/images/jiazai.gif"/><br/>
        <h4 class="lighter block green"></h4>
    </div>
</form>
</body>
</html>